package hn.sigit.dao.hnd.cadastre;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Order;

import hn.sigit.dao.SigitDAO;
import hn.sigit.model.hnd.cadastre.HND_Layer;

public class HND_LayerDAO extends SigitDAO<HND_Layer> {
	private static final long serialVersionUID = 1L;

	public static List<HND_Layer> loadLayers(boolean orderedByName) {
		return loadLayersOrderedByName(getSession(), orderedByName);
	}
	@SuppressWarnings("unchecked")
	public static List<HND_Layer> loadLayersOrderedByName(Session session, boolean orderedByName) {
		Criteria criteria = session.createCriteria(HND_Layer.class);
		
		if (orderedByName)
			criteria.addOrder(Order.asc("name"));
		
		return criteria.list();
	}
}
